<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        div{
            width: 100px;
            height: 100px;
            background: #4f1268;
            animation:nih 6s /*ease-out 1s*/ infinite /*alternate*/ /*backwards*/ /*forwards*/;
        }
        @keyframes nih {
            0%{
                /*left: 100px;
                top: 100px;*/
            }
            25%{
                /*left: 700px;
                top:100px;*/
                background: #578f14;
            }
            50%{
                /*left: 700px;
                top:400px;*/
                border-radius: 10px;
                background: red;
                width: 200px;
            }
            75%{
              /*  left: 100px;
                top:400px;*/
                background: #2e8eb6;
            }
            100%{
                /*left: 100px;
                top: 100px;*/
                background: #005aff;
                width: 0px;
            }
        }
    </style>
</head>
<body>
        <div></div>
</body>
</html>